def longestAlternatingSubarray(nums,threshold) -> int:
    curr_max = 0
    for i in range(len(nums)):
        start = i 
        end = i
        for j in range(i, len(nums)-1):
            if nums[j] >threshold:
                end = j
                print(j - i)
                curr_max = max(curr_max, end - start)
                break
            if  nums[j + 1]%2 == nums[j] % 2:
                end = j
                print(j - i)
                curr_max = max(curr_max, end - start)
                break
    return curr_max
